// using jquery.timers-1.2.js

jsForms.Templates["common.Timer"]='<p/>';
jsForms.Components["common.Timer"]={
	Init:function()
	{
		this.P.TimerID = new Date().valueOf();
		if (this.P.AutoStart != false){
			this.Start();
		}
		return jsForms.Components.Component.Init.call(this);
	},
	Start:function(){
		var mainControl = this;
		function onTimer(){
			mainControl._ExecEvent('onTimer',mainControl);
		}
		if (this.P.Interval == undefined){
			this.oneTime(0,onTimer);
		}else{
			this.everyTime(this.P.Interval ,onTimer);
		}
	},
	Stop:function(){
		this.stopTimer();
	},
	SetInterval:function (value){
		this.P.Interval = value;
	}
};
// -----------------------------------------------
// Compilation INFO
// -----------------------------------------------
jsForms.CreateCompileInfoByObject(
{
	Name: "common.Timer",
	Properties: {
		Interval:{// undefined - oneTimer, other value is everTimer
				access:'direct'
			},
		AutoStart:{
			type:'Boolean',
			access:'direct'
		}
	},
	Events: {
		onTimer:{}
	}
});
